package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.manager.CmsSubjectManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CmsSubjectController {

    @Autowired
    CmsSubjectManager cmsSubjectManager;

    //根据专题名称分页获取商品专题
    @GetMapping("/subject/list")
    public R getByNameAndPage(@RequestParam(required = false)Integer pageNum,
                              @RequestParam(required = false)Integer pageSize,
                              @RequestParam(required = false)String keyword)
    {
       return cmsSubjectManager.getByNameAndPage(pageNum,pageSize,keyword);

    }


    @GetMapping("/subject/listAll")
    public R getAll()
    {
        return cmsSubjectManager.getAll();

    }

}
